package com.cssy.xxkj.logic.dao.impl;

import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.cssy.xxkj.logic.dao.LogicAllocationDAO;
import com.cssy.xxkj.logic.entity.LogicAllocationDO;
import com.plat.helper.SearchConditions;

public class LogicAllocationDAOImpl extends SqlMapClientDaoSupport implements
		LogicAllocationDAO {

	@Override
	public String insertLogicAllocationDO(LogicAllocationDO logicAllocationDO) {
		Object id = getSqlMapClientTemplate().insert("LogicAllocation.insert", logicAllocationDO);
		return (String) id;
	}

	@Override
	public Integer countLogicAllocationDOByExample(
			LogicAllocationDO logicAllocationDO) {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicAllocation.countByDOExample", logicAllocationDO);
        return count;
	}

	@Override
	public Integer updateLogicAllocationDO(LogicAllocationDO logicAllocationDO) {
		int result = getSqlMapClientTemplate().update("LogicAllocation.update", logicAllocationDO);
        return result;
	}

	@Override
	public LogicAllocationDO findLogicAllocationDOByPrimaryKey(String id) {
		LogicAllocationDO logicAllocationDO = (LogicAllocationDO) getSqlMapClientTemplate().queryForObject("LogicAllocation.findByPrimaryKey", id);
        return logicAllocationDO;
	}

	@Override
	public Integer deleteLogicAllocationDOByPrimaryKey(String id) {
		Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicAllocation.deleteByPrimaryKey", id);
        return rows;
	}
	
	@Override
	public List<LogicAllocationDO> find(SearchConditions scs)
			throws DataAccessException {
		List<LogicAllocationDO> list = getSqlMapClientTemplate().queryForList("LogicAllocation_ex.find", scs);
        return list;
	}

	@Override
	public Integer count(SearchConditions scs) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicAllocation_ex.count", scs);
        return count;
	}

	@Override
	public Integer deleteBizRemoved(String id) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().update("LogicAllocation_ex.deleteBizRemoved", id);
        return count;
	}

}
